import axios from "axios";
import { baseURL_dev } from "../config/baseURL";

// 初始化一个axios对象
const instance = axios.create({
    baseURL: baseURL_dev,
    // timeout: 30000,
    // headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});

// get请求方法
export const Get =async (url:string, params:object={}) => {
    let {data} = await instance.get(url, {params});
    return data;
};
// post请求方法
export const Post =async (url:string, params:object={}) => {
    let {data} = await instance.post(url, params);
    return data;
};
// Put请求方法
export const Put =async (url:string, params:object={}) => {
    let {data} = await instance.put(url, params);
    return data;
};
// Delete请求方法
export const Delete =async (url:string, params:object={}) => {
    let {data} = await instance.delete(url, params);
    return data;
};